<?php
class RegisterForm extends Zend_Form
{
	public function init()
	{
		$username = $this->createElement('text','username');
		$username->setLabel('Username:')
				->setRequired(true);
		
		$password = $this->createElement('password','password');
		$password->setLabel('Password:')
				->setRequired(true);
		
		$confirmPassword = $this->createElement('password','confirmPassword');
		$confirmPassword->setLabel('Confirm Password:')
						->setRequired(true);
		
		$fullName = $this->createElement('text','fullName');
		$fullName->setLabel('Full Name:')
				->setRequired(true);
		
		$email = $this->createElement('text','email');
		$email->setLabel('Email:')
				->setRequired(true)
				->addValidator('EmailAddress');
		
		$captaText = $this->createElement('text','captaText');
		$captaText->setLabel('Please enter the word as shown below:');
		
		$register = $this->createElement('submit','register');
		$register->setLabel('Add')
				->setDecorators(array(
							'viewHelper',
								'Errors',
								array('Description', array('tag'=>'', 'escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff;text-align:center','openOnly'=>true,'colspan'=>2,'align'=>'center')),
								//array('Label', array('tag'=>'td')),
								array(array('row'=>'HtmlTag'), array('tag'=>'tr','openOnly'=>true))
				));
				
		$cancel = $this->createElement('button','cancel');
		$cancel->setLabel('Cancel')
				->setDecorators(array(
							'viewHelper',
								'Errors',
								array('Description', array('tag'=>'', 'escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff','closeOnly'=>true)),
								//array('Label', array('tag'=>'td')),
								array(array('row'=>'HtmlTag'), array('tag'=>'tr','closeOnly'=>true))
				));
				
		$this->addElements(array(
						$username,
						$password,
						$confirmPassword,
						$fullName,
						$email,
						$captaText,
						$register,
						$cancel
		));
		
		$this->setElementDecorators(array(
								'viewHelper',
								'Errors',
								array('Description', array('tag'=>'', 'escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td', 'valign'=>'top','width'=>'70%', 'style'=> 'background-color:#ffffff;text-align:left')),
								array('Label', array('tag'=>'td')),
								array(array('row'=>'HtmlTag'), array('tag'=>'tr'))),
								array('username', 'password', 'confirmPassword', 'fullName', 'email','captaText')
								);
								
		$this->addDecorators(array(
				'FormElements',
				array('HtmlTag', array('tag' => 'table','width'=>'100%','cellspacing'=>'0','cellpadding'=>'0','border'=>'0','class'=>'pform')),
				'Form'
		));
		
	}
}